翻訳と辞書
Words near each other
・ Car (King of Caria)
・ Car (magazine)
・ Car (surname)
・ Car 54, Where Are You?
・ Car 54, Where Are You? (film)
・ Car 553
・ Car 67
・ Car 99
・ Car accessory socket
・ Car adapter
・ Car alarm
・ Car Alarm (album)
・ Car Alarm (disambiguation)
・ Car Allowance Rebate System
・ Car analogy
CAR and CDR
・ Car and Driver
・ Car and Driver (video game)
・ Car and Driver 10Best
・ Car and Driver Supercar Challenge
・ Car and Track
・ Car and Universal Finance Co Ltd v Caldwell
・ Car attendant
・ Car Audio Sports Organizations
・ Car Australia
・ Car Babes
・ Car Battler Joe
・ Car bomb
・ Car Bomb (band)
・ Car bomb (disambiguation)


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

CAR and CDR : ウィキペディア英語版
CAR and CDR

In computer programming, car and cdr ( or ) are primitive operations on cons cells (or "non-atomic S-expressions") introduced in the Lisp programming language. A cons cell is composed of two pointers; the ''car'' operation extracts the first pointer, and the ''cdr'' operation extracts the second.
Thus, the expression (car (cons ''x'' ''y'')) evaluates to ''x'', and (cdr (cons ''x'' ''y'')) evaluates to ''y''.
When cons cells are used to implement singly linked lists (rather than trees and other more complicated structures), the ''car'' operation returns the ''first'' element of the list, while ''cdr'' returns the ''rest'' of the list. For this reason, the operations are sometimes given the names ''first'' and ''rest'' or ''head'' and ''tail''.
== Etymology ==

Lisp was originally implemented on the IBM 704 computer, in the late 1950s. The 704 hardware had special support for splitting a 36-bit machine word into four parts, an "address part" and "decrement part" of 15 bits each and a "prefix part" and "tag part" of three bits each.
Precursors〔A Fortran-Compiled List-Processing Language ()〕
〔A Fortran-Compiled List-Processing Language; HTML transcription ()〕 to Lisp included functions:
*''car'' (short for "Contents of the Address part of Register number"),
*''cdr'' ("Contents of the Decrement part of Register number"),
*''cpr'' ("Contents of the Prefix part of Register number"), and
*''ctr'' ("Contents of the Tag part of Register number"),
each of which took a machine address as an argument, loaded the corresponding word from memory, and extracted the appropriate bits.
The 704 assembler macro for cdr was:〔Portions from NILS' LISP PAGES- (http://t3x.dyndns.org/LISP/QA/carcdr.html )〕

LXD JLOC,4
CLA 0,4
PDX 0,4
PXD 0,4

A machine word could be reassembled by ''cons'', which took four arguments (''a'',''d'',''p'',''t'').
The prefix and tag parts were dropped in the early stages of Lisp's design, leaving CAR, CDR, and a two-argument CONS.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「CAR and CDR」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.